<template>
    <view class="myPatient">
        <Navigation title="我的患者" backType="back" background="#fff" />
        <view class="bg ph-32 pv-32 mb-20" v-for="(item,index) in list">
            <view class="f ai-c">
                <image :src="item.userAvatar" class="w-100 h-100 b-100 mr-24"></image>
                <view>
                    <view class="fs-28 fw-600 text-color4">{{item.userNickName}}</view>
                    <view class="fs-28 mt-10 text-color4">{{item.mobile}}</view>
                </view>
            </view>
            <view class="f fc-w jc-s-b mt-8">
                <view class="w-333 h-140 b-12 box f ai-c mt-20 ph-20" v-for="(vl,ky) in item.petsDTO" :key="ky">
                    <image :src="vl.avatar" class="w-100 h-100 b-12 mr-20"></image>
                    <view>
                        <view class="fs-28 fw-600 text-color1">{{vl.name}}</view>
                        <view class="fs-24 text-color3 mt-4">{{vl.gender == 1 ? 'GG' : 'MM'}}/{{vl.age}}岁</view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { myPatient } from '@/services/api/index';
const list = ref<any[]>([]);
const curt = ref(0);
const listParams = ref<any>({
    pageNo: 1,
    pageSize: 10,
	
 
});
onShow(() => {
    list.value = [];
    listParams.value.pageNo = 1;
    getList();

});

async function getList() {
    const { data } = await myPatient(listParams.value);
    uni.stopPullDownRefresh();
	
    list.value = list.value.concat(data.list);
}

//下拉刷新
onPullDownRefresh(() => {
    list.value = [];
    listParams.value.pageNo = 1;
    getList();
});
//上拉加载
onReachBottom(() => {
    listParams.value.pageNo++;
    getList();
});

</script>
<style lang="scss" scoped>
.myPatient {
    background: #f5f5f5;
    min-height: 100vh;
    .box{
    background: #F5F5F5;
}
    .bg{
        background: #fff;
    }
}
</style>